/**
 * LVL.Power - A component that provides power.
 */

define(['blacksmith/game', 'lvl/component', 'lvl/components'], function() {


/**
 * Constructs an LVL.Power instance.
 * 
 * @param {object} args
 * @constructor
 * @extends LVL.Component
 */
LVL.Power = function(args) {
    
    args = args || {}
    args.name = args.name || 'POWER'
    args.width = (args.width !== undefined) ? args.width : 40
    args.height = (args.height !== undefined) ? args.height : 50
    args.depth = (args.depth !== undefined) ? args.depth : 40
    args.colour = (args.colour !== undefined) ? args.colour : 0x339933
    args.mass = (args.mass !== undefined) ? args.mass : 20
    args.power = 30
    
    LVL.Component.call(this, args)
    
}

LVL.Power.prototype = Object.create(LVL.Component.prototype)


/**
 * Updates component state.
 */
LVL.Power.prototype.update = function() {
    
    LVL.Component.prototype.update.call(this)
    
}



/**
 * Register this component.
 */
LVL.Components.register('POWER', LVL.Power,  ['LEVITATOR', 'POWER'], function() {
    
    GAME.Camera.object.position.set(0, 80, 150)
    GAME.panUp(-30)
    
    var c = new LVL.Power({angle:Math.PI*0.2})
    GAME.add(c)
    
    GAME.Renderer.render(GAME.Scene, GAME.Camera.object)
    var componentImage = GAME.Renderer.domElement.toDataURL("image/png")
    
    GAME.remove(c)
    
    GAME.panUp(30)
    
    return componentImage
    
})



})
